# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DataCatalog.V1.Model.GoogleCloudDatacatalogV1ColumnSchema do
  @moduledoc """
  A column within a schema. Columns can be nested inside other columns.

  ## Attributes

  *   `column` (*type:* `String.t`, *default:* `nil`) - Required. Name of the column. Must be a UTF-8 string without dots (.). The maximum size is 64 bytes.
  *   `defaultValue` (*type:* `String.t`, *default:* `nil`) - Optional. Default value for the column.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Optional. Description of the column. Default value is an empty string. The description must be a UTF-8 string with the maximum size of 2000 bytes.
  *   `gcRule` (*type:* `String.t`, *default:* `nil`) - Optional. Garbage collection policy for the column or column family. Applies to systems like Cloud Bigtable.
  *   `highestIndexingType` (*type:* `String.t`, *default:* `nil`) - Optional. Most important inclusion of this column.
  *   `lookerColumnSpec` (*type:* `GoogleApi.DataCatalog.V1.Model.GoogleCloudDatacatalogV1ColumnSchemaLookerColumnSpec.t`, *default:* `nil`) - Looker specific column info of this column.
  *   `mode` (*type:* `String.t`, *default:* `nil`) - Optional. A column's mode indicates whether values in this column are required, nullable, or repeated. Only `NULLABLE`, `REQUIRED`, and `REPEATED` values are supported. Default mode is `NULLABLE`.
  *   `ordinalPosition` (*type:* `integer()`, *default:* `nil`) - Optional. Ordinal position
  *   `rangeElementType` (*type:* `GoogleApi.DataCatalog.V1.Model.GoogleCloudDatacatalogV1ColumnSchemaFieldElementType.t`, *default:* `nil`) - Optional. The subtype of the RANGE, if the type of this field is RANGE. If the type is RANGE, this field is required. Possible values for the field element type of a RANGE include: * DATE * DATETIME * TIMESTAMP
  *   `subcolumns` (*type:* `list(GoogleApi.DataCatalog.V1.Model.GoogleCloudDatacatalogV1ColumnSchema.t)`, *default:* `nil`) - Optional. Schema of sub-columns. A column can have zero or more sub-columns.
  *   `type` (*type:* `String.t`, *default:* `nil`) - Required. Type of the column. Must be a UTF-8 string with the maximum size of 128 bytes.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :column => String.t() | nil,
          :defaultValue => String.t() | nil,
          :description => String.t() | nil,
          :gcRule => String.t() | nil,
          :highestIndexingType => String.t() | nil,
          :lookerColumnSpec =>
            GoogleApi.DataCatalog.V1.Model.GoogleCloudDatacatalogV1ColumnSchemaLookerColumnSpec.t()
            | nil,
          :mode => String.t() | nil,
          :ordinalPosition => integer() | nil,
          :rangeElementType =>
            GoogleApi.DataCatalog.V1.Model.GoogleCloudDatacatalogV1ColumnSchemaFieldElementType.t()
            | nil,
          :subcolumns =>
            list(GoogleApi.DataCatalog.V1.Model.GoogleCloudDatacatalogV1ColumnSchema.t()) | nil,
          :type => String.t() | nil
        }

  field(:column)
  field(:defaultValue)
  field(:description)
  field(:gcRule)
  field(:highestIndexingType)

  field(:lookerColumnSpec,
    as: GoogleApi.DataCatalog.V1.Model.GoogleCloudDatacatalogV1ColumnSchemaLookerColumnSpec
  )

  field(:mode)
  field(:ordinalPosition)

  field(:rangeElementType,
    as: GoogleApi.DataCatalog.V1.Model.GoogleCloudDatacatalogV1ColumnSchemaFieldElementType
  )

  field(:subcolumns,
    as: GoogleApi.DataCatalog.V1.Model.GoogleCloudDatacatalogV1ColumnSchema,
    type: :list
  )

  field(:type)
end

defimpl Poison.Decoder, for: GoogleApi.DataCatalog.V1.Model.GoogleCloudDatacatalogV1ColumnSchema do
  def decode(value, options) do
    GoogleApi.DataCatalog.V1.Model.GoogleCloudDatacatalogV1ColumnSchema.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DataCatalog.V1.Model.GoogleCloudDatacatalogV1ColumnSchema do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
